from sqlalchemy import Column

from apps.db import BaseModel, String


class HouseApprove(BaseModel):
    __tablename__ = 'tb_house_approve'
    extend_id = Column(String, comment='关联bank_side_info_extend')
    qz_type = Column(String, comment='权证类型')
    qz_no = Column(String, comment='权证编号')
    dj_apartment_type = Column(String, comment='登记机构类型')
    dj_apartment = Column(String, comment='登记机构名称')
    dj_amt = Column(String, comment='登记金额')
    dj_start_date = Column(String, comment='登记开始日期')
    dj_end_date = Column(String, comment='登记结束日期')
    has_end = Column(String, comment='是否存在结束时间')
    file = Column(String, comment='证书文件名')
    # count = Column(String, comment="封包编号")

    def __init__(self, *args, **kwargs):
        super(HouseApprove, self).__init__()
        for attr, value in kwargs.items():
            if attr in self.__column_name_list__() and getattr(self, attr) is None:
                setattr(self, attr, value)
